#ifndef _PERIPHERAL_TRANSMIT_TASK_
#define _PERIPHERAL_TRANSMIT_TASK_

/**
 * @brief 电机的CAN信号帧发送
 * @note  总线挂载情况：CAN1-(4*M3508底盘电机)+(GM6020yaw电机+电容控制板通信)；CAN2-(GM6020pitch电机+2*M3508摩擦轮电机)+MS4010拨盘电机
 */
void MotorControlCANSend(void);
/**
 * @brief LED闪烁实现
 */
void LEDShow(void);

void UpperCommRecHandler(uint8_t* rec_buf, uint32_t size);
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define UPPER_PC_COMM_SEND_LENGTH 24
#define UPPER_PC_COMM_REC_LENGTH 16
#define UPPER_PC_COMM_REC_SOF 0x33
#define UPPER_PC_COMM_REC_EOF 0xEE
/*all receive control frame type*/
#define NO_AIM_NOR_SHOOT 0x00
#define AIM_BUT_NOT_SHOOT 0x01
#define AIM_AND_SHOOT 0x02
#define AIM_AND_SHOOT_ONCE 0x03

/*all send task mode frame type*/
#define AUTO_AIM 0x01
#define BUFF_AIM 0x02
#define HANG_AIM 0x03

#define RED_TEAM_FRAME 0xAA
#define BLUE_TEAM_FRAME 0xBB

#define COM_FAIL  0x00
#define NO_CAMERA 0x11
#define NO_TARGET 0x22
#define FIND_TARGET 0x33


#define SHOOT_BUFF_ON 1
#define SHOOT_BUFF_OFF 0



/**
 * @brief 上位机通信结构体
 */
typedef struct
{
	uint16_t rec_counter;
	struct
	{
		uint8_t sof;
		uint8_t reserved1[3];
		float target_pitch_angle_d; 
		float target_yaw_angle_d;
		uint8_t shoot_mode;
		uint8_t shoot_buff_mode;
		uint8_t aiming_state;
		uint8_t eof;
		
	}Receive;
	struct
	{
        uint8_t sof;
		uint8_t reserved[3];
		float gimbal_roll_d;
		float gimbal_yaw_d;
		float gimbal_pitch_d;	
		float gimbal_yaw_dps;
		uint8_t task_mode;
		uint8_t bullet_speed;
		uint8_t self_team;
        uint8_t eof;	
	}Send;
}UpperComputerComm;
#endif

